﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DBComparer
{
    [DefaultEvent("ComputeMode")]
    [DefaultProperty("Mode")]
    public partial class ComputeMode : UserControl
    {
        public enum Modes 
        {
            Basic,
            Levenshtein
        }

        public Modes Mode { 
            get 
            {
                if (cbo!=null)
                {
                    if (cbo.SelectedValue!=null) // Design Mode Bug!
                    {
                        return (Modes)cbo.SelectedValue; 
                    }
                }
                return Modes.Basic;
            } 
            set { cbo.SelectedValue = (Modes)value; } }

        public event EventHandler ModeChange;

        public ComputeMode()
        {
            InitializeComponent();
        }

        private void ComputeMode_Load(object sender, EventArgs e)
        {
            cbo.DataSource = Enum.GetValues(typeof(Modes));

            this.cbo.SelectedIndexChanged += new System.EventHandler(this.cbo_SelectedIndexChanged);
        }

        private void cbo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ModeChange!=null)
                ModeChange(sender, e);
        }
    }
}
